import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.http.*;

public class EvenOdd extends HttpServlet
{
	 public void doPost(HttpServletRequest request, HttpServletResponse response)
    {
           processRequest(request,response);
    }
  public void doGet(HttpServletRequest request, HttpServletResponse response)
  {
	      processRequest(request,response);
  }
   public void processRequest(HttpServletRequest request, HttpServletResponse response)
  {
    try
     {
       PrintWriter out=response.getWriter();
       response.setContentType("text/html");
       
       int n = Integer.parseInt(request.getParameter("myno"));
       	if(n<=0)
			response.sendRedirect("Error.html");
	   out.println("<html>");
       out.println("<body bgcolor=yellow>");
       out.println("Even/Odd Testing!<br>");
	   out.println("Your No. " + n+" is ");
	   if(n%2==0)
			out.println("<font color=red>Even</font>");
	   else
		   out.println("<font color=green>Odd</font>");

       out.println("</body>");
       out.println("</html>");
     }catch(Exception e)
      {
         //out.println(e.toString());
      }
  }
}
